<template>
	<!-- 底部导航栏 -->
	<view class="bottom-tabbar flex-between-row">
		<view @click="changeTab(index)" class="p-x-30 flex-center-column" v-for="(item,index) in tabbarList"
			:key="index">
			<image v-show="!item.is_show" :src="item.image" mode=""></image>
			<image v-show="item.is_show" :src="item.image1" mode=""></image>
			<view :class="item.is_show?'col-0':'col-9'" class="f-26 t-c">{{item.label}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "tabbar",
		props: {
			current: {
				type: Number
			}
		},
		data() {
			return {
				tabbarList: [{
					label: '',
					is_show: true,
					image: 'https://study108.oss-rg-china-mainland.aliyuncs.com/tabber/index.png',
					image1: 'https://study108.oss-rg-china-mainland.aliyuncs.com/tabber/index1.png',
					path: '/pages/index/index'
				}, {
					label: '',
					is_show: false,
					image: 'https://study108.oss-rg-china-mainland.aliyuncs.com/tabber/dynamic.png',
					image1: 'https://study108.oss-rg-china-mainland.aliyuncs.com/tabber/dynamic1.png',
					path: '/pages/index/rank'
				}, {
					label: '',
					is_show: false,
					image: 'https://study108.oss-rg-china-mainland.aliyuncs.com/tabber/my.png',
					image1: 'https://study108.oss-rg-china-mainland.aliyuncs.com/tabber/my1.png',
					path: '/pages/index/my'
				}],
			};
		},
		created() {
			this.tabbarList.forEach(item => item.is_show = false)
			this.tabbarList[this.current].is_show = true
		},
		methods: {
			changeTab(index) {
				if (this.tabbarList[index].is_show) {
					return
				}
				this.goLink(this.tabbarList[index].path)

			}
		}
	}
</script>

<style lang="scss" scoped>
	.bottom-tabbar {
		position: fixed;
		bottom: 0;
		left: 0;
		padding: 0 50rpx;
		width: 100%;
		height: 160rpx;
		background-color: rgba(255, 255, 255, 0.9);
		border-radius: 40rpx 40rpx 0 0;

		image {
			width: 80rpx;
			height: 80rpx;
		}
	}
</style>
